package com.mud.mudcommune.view.fragment.threeLevel;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.mud.mudcommune.R;
import com.mud.mudcommune.adapter.DesignWorkAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by zhoujin on 2016/12/12.
 */

public class DesignWorkFragment extends Fragment {
    private static Fragment fragment = new DesignWorkFragment();
    @BindView(R.id.design_list)
    RecyclerView mRecyclerView;
    List designList;
    private DesignWorkAdapter adapter;
    Unbinder unbinder;

    public static Fragment getInstance() {
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_work_design, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        LinearLayoutManager manager = new LinearLayoutManager(getContext());
        manager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecyclerView.setLayoutManager(manager);
        mRecyclerView.setHasFixedSize(true);
        designList = new ArrayList();
        designList.add("1");
        designList.add("2");
        designList.add("3");
        designList.add("1");
        designList.add("2");
        designList.add("3");
        adapter = new DesignWorkAdapter(getContext(), designList);
        mRecyclerView.setAdapter(adapter);
    }
}
